﻿Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

Namespace Dominio
    <Serializable()> _
    Public Class ActividadPosta
        Inherits SIAVU.Dominio.Actividad

#Region "Variables"
        Private _Posta As Posta = Nothing
#End Region

#Region "Propiedades"

        Public Overridable Property Posta() As Posta
            Get
                If _Posta Is Nothing Then
                    _Posta = New Posta
                End If
                Return _Posta
            End Get
            Set(ByVal value As Posta)
                _Posta = value
            End Set
        End Property

        Public Overrides Property FechaFin() As Date
            Get
                Return Me.Posta.VueloVuelta.FechaLlegada
            End Get
            Set(ByVal value As Date)
                Me.Posta.VueloVuelta.FechaLlegada = value
            End Set
        End Property

        Public Overrides Property FechaInicio() As Date
            Get
                Return Me.Posta.VueloIda.FechaSalida
            End Get
            Set(ByVal value As Date)
                Me.Posta.VueloIda.FechaSalida = value
            End Set
        End Property

        Public Overrides ReadOnly Property Descripcion() As String
            Get
                Return Me.Posta.VueloIda.CiudadOrigen.Descripcion + " - " + Me.Posta.VueloIda.CiudadDestino.Descripcion
            End Get
        End Property

        Public Overrides ReadOnly Property TipoActividadID() As Integer
            Get
                Return ETipoActividad.Posta
            End Get
        End Property

        Public Overrides Property CiudadDestidoID() As Long
            Get
                Return Me.Posta.VueloIda.CiudadDestino.CiudadID
            End Get
            Set(ByVal value As Long)
                MyBase.CiudadDestidoID = value
            End Set
        End Property

        Public Overrides Property InformacionCompleta() As String
            Get

                If MyBase.InformacionCompleta = "" Then
                    Dim sAux As New StringBuilder
                    sAux.AppendLine("<b><u><font size=3>" + Me.Descripcion + "</font></u></b><br />")
                    sAux.AppendLine("<b>Salida: </b>" + Me.FechaInicio + "<br />")
                    sAux.AppendLine("<b>Llegada: </b>" + Me.FechaFin + "<br />")


                    Select Case HttpContext.Current.Request.Url.AbsolutePath.ToUpper()
                        Case "/Presentacion/PreProgramacion.aspx".ToUpper()
                            sAux.AppendLine("<b>Auxiliares subscriptos: </b>" + Me.Posta.CantidadAuxiliaresSubscriptos.ToString + "/<b>" + Me.Posta.VueloIda.Avion.CantidadAuxiliaresMaximo.ToString + "</b><br />")
                            sAux.AppendLine("<b>Comisarios subscriptos: </b>" + Me.Posta.CantidadComisariosSubscriptos.ToString + "/<b>" + Me.Posta.VueloIda.Avion.CantidadComisariosMaximo.ToString + "</b><br />")
                            sAux.AppendLine("<b>Jefes de cabina subscriptos: </b>" + Me.Posta.CantidadJefesCabinaSubscriptos.ToString + "/<b>" + Me.Posta.VueloIda.Avion.CantidadJefesCabinaMaximo.ToString + "</b>")

                        Case "/Presentacion/VerHistorial.aspx".ToUpper()
                            If Me.Motivo <> String.Empty Then
                                sAux.AppendLine(Me.Motivo)
                            End If
                    End Select

                    Return sAux.ToString
                Else
                    Return MyBase.InformacionCompleta
                End If

            End Get
            Set(ByVal value As String)
                MyBase.InformacionCompleta = value
            End Set
        End Property

#End Region

#Region "Metodos"

        Public Overridable Sub agregarActividad(ByVal Reglas As List(Of Regla))

        End Sub

        Public Overridable Sub GetPosta()
            Me.Posta.GetById(Me.Posta)

        End Sub

#End Region

    End Class
End Namespace

